package com.integration.rest.service;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.StreamingOutput;

public class FileStreamingOutput implements StreamingOutput {
	private InputStream input;
	public FileStreamingOutput(InputStream input) {
		this.input = input;
	}

	@Override
	public void write(OutputStream arg0) throws IOException, WebApplicationException {
		int b;
		while ((b = input.read()) != -1){
			arg0.write(b);
		}
	}

}